import 'dart:async';

import '../../commons/log.dart';
import 'auth_repository.dart';

class ScheduelRepository {
  ScheduelRepository({
    required AuthRepository authRepository,
  }) : _authRepository = authRepository {
    Timer.periodic(const Duration(minutes: 10), (timer) async {
      try {
        await authRepository.checkAccessToken();
        _log.debug('checkAccessToken success');
      } catch (e) {
        _log.error('checkAccessToken error', e);
      }
    });
  }
  final _log = Log();
  late final AuthRepository _authRepository;

  Future<void> start() async {
    await _authRepository.checkAccessToken();
  }
}
